<!DOCTYPE HTML>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
	<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
	<title>Hello APP</title>
	<link rel="stylesheet" type="text/css" href="../../css/aui-flex.css" />
	<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
	<link rel="stylesheet" type="text/css" href="../../css/common.css" />
	<style>
		.aui-pull-right {
			color: #363436 !important;
			font-size: 0.8rem;
		}

		.checkAll {
			padding: 0 0 0 1.25rem;
			background-repeat: no-repeat;
			background-position: left center;
			background-size: 1rem;
			background-image: url(../../image/common/radio_off.png);
		}

		.checkAll.on {
			background-image: url(../../image/common/radio_on.png);
		}

		.cartBar {
			background-color: #FFF;
			height: 2.5rem;
			line-height: 2.5rem;
		}

		.cartBar .payBtn {
			color: #FFF;
			width: 5rem;
			height: 100%;
			text-align: center;
		}

		.cartBar .text {
			padding: 0 0.75rem;
			text-align: right;
			line-height: 1.5;
		}
	</style>
</head>

<body>
	<header class="aui-bar aui-bar-nav aui-bar-light" id="header">
		<div class="aui-pull-left back" tapmode onclick="api.closeWin()"></div>
		<div class="aui-title">购物车</div>
	</header>
	<div class="btmFix" id="footer">
		<div class="cartBar aui-flex-col aui-flex-middle aui-padded-l-15">
			<div class="checkAll" tapmode onClick="checkAll();">全选</div>
			<div class="flex-auto text">
				<div>合计：<span class="color-red aui-font-size-15"><span id="totalUcoin">0</span>积分</span>
				</div>
				<div class="aui-font-size-10 color-666">可用积分<span id="youUcion">0</span>枚</div>
			</div>
			<div class="payBtn bg-red" tapmode onclick="buy();">结算</div>
		</div>
	</div>
</body>
<script type="text/javascript" src="../../script/import.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
	apiready = function() {
		api.parseTapmode();
		var header = $api.byId('header');
		$api.fixStatusBar(header);
		var headerH = $api.offset(header).h;
		var footerH = $api.offset($api.byId('footer')).h;
		api.openFrame({
			name: 'u_cart_frm',
			url: 'u_cart_frm.html',
			rect: {
				x: 0,
				y: headerH,
				w: 'auto',
				h: 'auto',
				marginBottom: footerH
			},
			bgColor: '#f5f5f5',
			bounces: true,
			reload: true,
			pageParam: api.pageParam
		});
			api.ajax({
			    url: BASE_URL + 'App/User/getUCion',
			    method: 'post',
			    data: {
			        values: {
			            userid: getUserId()
			        }
			    }
			},function(ret, err){
			    if (ret) {
						var txt = $$('#youUcion').text(ret.user_coin);
			    } else {
			        alert( JSON.stringify( err ) );
			    }
			});
	};

	function checkAll() {
		var flag;
		$$('.checkAll').toggleClass('on');
		if ($$('.checkAll').hasClass('on')) {
			flag = true;
		} else {
			flag = false;
		}
		api.execScript({
			frameName: 'u_cart_frm',
			script: 'checkAll(' + flag + ')'
		});
	}

	function setActive(n) {
		if (n) {
			$$('.checkAll').addClass('on');
		} else {
			$$('.checkAll').removeClass('on');
		}
	}

	function buy() {
		api.execScript({
			frameName: 'u_cart_frm',
			script: 'buy()'
		});
	}
</script>

</html>
